export default {
	data() {
		return {
			filterParams: {
				brandList: [], // 商品品牌
				brandSelect: '',
				styleList: [], // 商品风格
				styleSelect: '',
				materialList: [], // 商品材质
				materialSelect: '',
				minPrice: null, // 最低价
				maxPrice: null, // 最高价
			},
			filterOriginParams: {
				brandList: [], // 商品品牌
				brandSelect: '',
				styleList: [], // 商品风格
				styleSelect: '',
				materialList: [], // 商品材质
				materialSelect: '',
				minPrice: null, // 最低价
				maxPrice: null, // 最高价
			}, // 筛选项原始数据
		}
	},
	methods: {
		handleConfirmFilter(data) {
			if (data) {
				this.filterParams = data
			} else {
				this.filterParams = {
					...JSON.parse(JSON.stringify(this.filterOriginParams)),
					brandSelect: '',
					styleSelect: '',
					materialSelect: '',
					minPrice: null,
					maxPrice: null,
				}
			}
			this.filterPopShow = false
			const {
				brandSelect,
				styleSelect,
				materialSelect,
				minPrice,
				maxPrice,
			} = data || this.filterParams
			const {
				brandId,
				styleId,
				materialId,
				startMoney,
				endMoney,
				...otherParams
			} = this.params
			this.params = {
				...otherParams,
				...brandSelect ? {
					brandId: brandSelect
				} : {},
				...styleSelect ? {
					styleId: styleSelect
				} : {},
				...materialSelect ? {
					materialId: materialSelect
				} : {},
				...minPrice ? {
					startMoney: minPrice
				} : {},
				...maxPrice ? {
					endMoney: maxPrice
				} : {},
			}
			this.getData(true)
		},
	}
}